<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>兴趣问答测试 - 发现你的爱好</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #4f46e5;
            --primary-light: #818cf8;
            --primary-dark: #3730a3;
            --secondary: #ec4899;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --text-light: #94a3b8;
            --bg-light: #f8fafc;
            --bg-white: #ffffff;
            --border-light: #e2e8f0;
            --radius: 12px;
            --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            --transition: all 0.3s ease;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 56px;
            padding-bottom: 70px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
        }
        
        .nav-title {
            font-size: 1.15rem;
            font-weight: 600;
            text-align: center;
            flex: 1;
        }
        
        .nav-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: var(--transition);
        }
        
        .nav-btn:hover {
            background-color: var(--bg-light);
            color: var(--primary);
        }
        
        /* 搜索栏 */
        .search-container {
            padding: 12px 16px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
        }
        
        .search-box {
            position: relative;
        }
        
        .search-input {
            width: 100%;
            padding: 10px 16px 10px 40px;
            border: 1px solid var(--border-light);
            border-radius: 8px;
            font-size: 0.9rem;
            background-color: var(--bg-light);
            transition: var(--transition);
        }
        
        .search-input:focus {
            outline: none;
            border-color: var(--primary-light);
            box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
        }
        
        .search-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }
        
        /* 分类标签 */
        .categories {
            padding: 10px 16px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            overflow-x: auto;
            scrollbar-width: none;
        }
        
        .categories::-webkit-scrollbar {
            display: none;
        }
        
        .categories-container {
            display: flex;
            gap: 10px;
            white-space: nowrap;
        }
        
        .category-item {
            padding: 6px 16px;
            border-radius: 20px;
            font-size: 0.85rem;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            transition: var(--transition);
            cursor: pointer;
        }
        
        .category-item.active {
            background-color: var(--primary);
            color: white;
        }
        
        .category-item:hover:not(.active) {
            background-color: #e2e8f0;
        }
        
        /* 测试列表 */
        .tests-list {
            padding: 12px 16px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        
        /* 无图测试项 */
        .test-item.no-image {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            padding: 16px;
            box-shadow: var(--shadow);
            transition: var(--transition);
        }
        
        /* 单图测试项 */
        .test-item.single-image {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: var(--transition);
        }
        
        /* 多图测试项 */
        .test-item.multi-image {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: var(--transition);
        }
        
        .test-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        }
        
        /* 测试内容区 */
        .test-content {
            padding: 16px;
        }
        
        .test-category {
            display: inline-block;
            padding: 2px 8px;
            background-color: rgba(79, 70, 229, 0.1);
            color: var(--primary);
            font-size: 0.75rem;
            border-radius: 4px;
            margin-bottom: 8px;
        }
        
        .test-title {
            font-size: 1.05rem;
            font-weight: 600;
            margin-bottom: 8px;
            line-height: 1.4;
        }
        
        .test-desc {
            font-size: 0.9rem;
            color: var(--text-secondary);
            line-height: 1.5;
            margin-bottom: 12px;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        
        /* 图片容器 */
        .test-image {
            width: 100%;
        }
        
        .test-image img {
            width: 100%;
            aspect-ratio: 16/9;
            object-fit: cover;
        }
        
        .multi-images-container {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 2px;
        }
        
        .multi-image-item {
            aspect-ratio: 1;
            overflow: hidden;
        }
        
        .multi-image-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        /* 测试信息 */
        .test-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.8rem;
            color: var(--text-light);
        }
        
        .meta-left {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .meta-item {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .start-test {
            padding: 4px 12px;
            background-color: var(--primary);
            color: white;
            border-radius: 4px;
            font-size: 0.85rem;
            transition: var(--transition);
        }
        
        .start-test:hover {
            background-color: var(--primary-dark);
        }
        
        /* 结果统计 */
        .results-stats {
            display: flex;
            gap: 12px;
            margin: 8px 0;
        }
        
        .stat-item {
            flex: 1;
            text-align: center;
            padding: 6px;
            background-color: var(--bg-light);
            border-radius: 6px;
        }
        
        .stat-value {
            font-size: 1rem;
            font-weight: 600;
            color: var(--primary);
            margin-bottom: 2px;
        }
        
        .stat-label {
            font-size: 0.7rem;
            color: var(--text-secondary);
        }
        
        /* 加载更多 */
        .load-more {
            margin: 16px 0;
            padding: 12px;
            text-align: center;
            color: var(--primary);
            font-size: 0.9rem;
            background-color: var(--bg-white);
            border-radius: var(--radius);
            border: 1px solid var(--border-light);
            transition: var(--transition);
        }
        
        .load-more:hover {
            background-color: var(--bg-light);
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 65px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            text-decoration: none;
        }
        
        .nav-item i {
            font-size: 1.25rem;
            margin-bottom: 4px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        /* 空状态 */
        .empty-state {
            padding: 60px 20px;
            text-align: center;
            color: var(--text-secondary);
        }
        
        .empty-state i {
            font-size: 3rem;
            margin-bottom: 16px;
            color: var(--border-light);
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-btn" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">兴趣问答测试</div>
        <button class="nav-btn" id="createBtn">
            <i class="fas fa-plus"></i>
        </button>
    </div>
    
    <!-- 搜索栏 -->
    <div class="search-container">
        <div class="search-box">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索兴趣测试...">
        </div>
    </div>
    
    <!-- 分类标签 -->
    <div class="categories">
        <div class="categories-container">
            <div class="category-item active">全部</div>
            <div class="category-item">性格测试</div>
            <div class="category-item">兴趣爱好</div>
            <div class="category-item">职业倾向</div>
            <div class="category-item">情感关系</div>
            <div class="category-item">知识挑战</div>
            <div class="category-item">趣味娱乐</div>
            <div class="category-item">心理健康</div>
        </div>
    </div>
    
    <!-- 测试列表 -->
    <div class="tests-list" id="testsList">
        <!-- 无图测试项 -->
        <div class="test-item no-image">
            <div class="test-content">
                <span class="test-category">性格测试</span>
                <h3 class="test-title">你的隐藏性格是什么？10道题揭示真实的你</h3>
                <p class="test-desc">通过日常行为偏好和选择，分析你的潜在性格特质，帮助你更了解自己的内心世界。</p>
                
                <div class="results-stats">
                    <div class="stat-item">
                        <div class="stat-value">12题</div>
                        <div class="stat-label">题目数量</div>
                    </div>
                    <div class="stat-item">
                        <div class="stat-value">5分钟</div>
                        <div class="stat-label">完成时间</div>
                    </div>
                    <div class="stat-item">
                        <div class="stat-value">86%</div>
                        <div class="stat-label">准确率</div>
                    </div>
                </div>
                
                <div class="test-meta">
                    <div class="meta-left">
                        <div class="meta-item">
                            <i class="fas fa-user"></i>
                            <span>12.5k 人已测</span>
                        </div>
                        <div class="meta-item">
                            <i class="fas fa-star"></i>
                            <span>4.8</span>
                        </div>
                    </div>
                    <div class="start-test">开始测试</div>
                </div>
            </div>
        </div>
        
        <!-- 单图测试项 -->
        <div class="test-item single-image">
            <div class="test-image">
                <img src="https://picsum.photos/id/26/800/450" alt="旅行偏好测试">
            </div>
            <div class="test-content">
                <span class="test-category">兴趣爱好</span>
                <h3 class="test-title">你的旅行风格是什么？从选择中看出你的旅行偏好</h3>
                <p class="test-desc">通过对目的地、旅行方式和活动的选择，分析你的旅行风格和潜在偏好。</p>
                
                <div class="test-meta">
                    <div class="meta-left">
                        <div class="meta-item">
                            <i class="fas fa-user"></i>
                            <span>8.3k 人已测</span>
                        </div>
                        <div class="meta-item">
                            <i class="fas fa-star"></i>
                            <span>4.7</span>
                        </div>
                    </div>
                    <div class="start-test">开始测试</div>
                </div>
            </div>
        </div>
        
        <!-- 多图测试项 -->
        <div class="test-item multi-image">
            <div class="multi-images-container">
                <div class="multi-image-item">
                    <img src="https://picsum.photos/id/96/300/300" alt="美食偏好1">
                </div>
                <div class="multi-image-item">
                    <img src="https://picsum.photos/id/292/300/300" alt="美食偏好2">
                </div>
                <div class="multi-image-item">
                    <img src="https://picsum.photos/id/431/300/300" alt="美食偏好3">
                </div>
            </div>
            <div class="test-content">
                <span class="test-category">兴趣爱好</span>
                <h3 class="test-title">从食物选择看你的性格，你的味蕾藏着什么秘密？</h3>
                <p class="test-desc">不同的饮食偏好反映了不同的性格特质，通过15道美食相关问题揭示你的个性。</p>
                
                <div class="results-stats">
                    <div class="stat-item">
                        <div class="stat-value">15题</div>
                        <div class="stat-label">题目数量</div>
                    </div>
                    <div class="stat-item">
                        <div class="stat-value">7分钟</div>
                        <div class="stat-label">完成时间</div>
                    </div>
                </div>
                
                <div class="test-meta">
                    <div class="meta-left">
                        <div class="meta-item">
                            <i class="fas fa-user"></i>
                            <span>15.2k 人已测</span>
                        </div>
                        <div class="meta-item">
                            <i class="fas fa-star"></i>
                            <span>4.9</span>
                        </div>
                    </div>
                    <div class="start-test">开始测试</div>
                </div>
            </div>
        </div>
        
        <!-- 无图测试项 -->
        <div class="test-item no-image">
            <div class="test-content">
                <span class="test-category">职业倾向</span>
                <h3 class="test-title">适合你的职业方向是什么？基于MBTI的职业测试</h3>
                <p class="test-desc">结合MBTI性格理论，分析你的职业倾向和适合的工作环境，为职业规划提供参考。</p>
                
                <div class="test-meta">
                    <div class="meta-left">
                        <div class="meta-item">
                            <i class="fas fa-user"></i>
                            <span>9.7k 人已测</span>
                        </div>
                        <div class="meta-item">
                            <i class="fas fa-star"></i>
                            <span>4.6</span>
                        </div>
                    </div>
                    <div class="start-test">开始测试</div>
                </div>
            </div>
        </div>
        
        <!-- 单图测试项 -->
        <div class="test-item single-image">
            <div class="test-image">
                <img src="https://picsum.photos/id/1059/800/450" alt="色彩偏好测试">
            </div>
            <div class="test-content">
                <span class="test-category">趣味娱乐</span>
                <h3 class="test-title">色彩偏好测试：你喜欢的颜色揭示了什么性格？</h3>
                <p class="test-desc">颜色选择与性格特质密切相关，通过你对不同颜色的偏好，分析你的性格特点。</p>
                
                <div class="results-stats">
                    <div class="stat-item">
                        <div class="stat-value">8题</div>
                        <div class="stat-label">题目数量</div>
                    </div>
                    <div class="stat-item">
                        <div class="stat-value">3分钟</div>
                        <div class="stat-label">完成时间</div>
                    </div>
                </div>
                
                <div class="test-meta">
                    <div class="meta-left">
                        <div class="meta-item">
                            <i class="fas fa-user"></i>
                            <span>7.4k 人已测</span>
                        </div>
                        <div class="meta-item">
                            <i class="fas fa-star"></i>
                            <span>4.5</span>
                        </div>
                    </div>
                    <div class="start-test">开始测试</div>
                </div>
            </div>
        </div>
        
        <!-- 加载更多 -->
        <div class="load-more" id="loadMore">
            加载更多测试
        </div>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-compass"></i>
            <span>发现</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-question-circle"></i>
            <span>测试</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-user"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // DOM元素
        const backBtn = document.getElementById("backBtn");
        const createBtn = document.getElementById("createBtn");
        const categoryItems = document.querySelectorAll(".category-item");
        const loadMoreBtn = document.getElementById("loadMore");
        const testsList = document.getElementById("testsList");
        const searchInput = document.querySelector(".search-input");
        
        // 测试数据
        const moreTests = [
            {
                type: "no-image",
                category: "情感关系",
                title: "你在恋爱中的依恋类型是什么？测试你的情感模式",
                desc: "通过12道题，分析你在亲密关系中的依恋类型，帮助你理解自己的情感需求和模式。",
                stats: {
                    questions: 12,
                    time: "6分钟"
                },
                meta: {
                    users: "6.8k",
                    rating: 4.7
                }
            },
            {
                type: "multi-image",
                category: "知识挑战",
                title: "世界文化常识测试，你能答对多少题？",
                desc: "涵盖艺术、历史、文学等多个领域的文化常识，看看你的知识面有多广。",
                images: [
                    "https://picsum.photos/id/429/300/300",
                    "https://picsum.photos/id/433/300/300",
                    "https://picsum.photos/id/452/300/300"
                ],
                meta: {
                    users: "4.3k",
                    rating: 4.4
                }
            },
            {
                type: "single-image",
                category: "心理健康",
                title: "你的压力来源是什么？找出影响你情绪的关键因素",
                desc: "通过对日常感受和反应的分析，帮助你识别主要的压力来源，并提供缓解建议。",
                image: "https://picsum.photos/id/1060/800/450",
                stats: {
                    questions: 10,
                    time: "4分钟",
                    accuracy: "82%"
                },
                meta: {
                    users: "5.2k",
                    rating: 4.6
                }
            }
        ];
        
        // 初始化
        function init() {
            setupEventListeners();
        }
        
        // 设置事件监听
        function setupEventListeners() {
            // 返回按钮
            backBtn.addEventListener("click", () => {
                history.back();
            });
            
            // 创建测试按钮
            createBtn.addEventListener("click", () => {
                alert("创建新的兴趣问答测试");
            });
            
            // 分类标签点击
            categoryItems.forEach(item => {
                item.addEventListener("click", function() {
                    // 移除其他标签的活跃状态
                    categoryItems.forEach(cat => cat.classList.remove("active"));
                    // 添加当前标签的活跃状态
                    this.classList.add("active");
                    
                    // 显示加载状态
                    showLoading();
                    
                    // 模拟筛选延迟
                    setTimeout(() => {
                        hideLoading();
                    }, 800);
                });
            });
            
            // 加载更多
            loadMoreBtn.addEventListener("click", loadMoreTests);
            
            // 搜索功能
            searchInput.addEventListener("input", (e) => {
                const keyword = e.target.value.trim();
                // 延迟搜索，避免频繁触发
                clearTimeout(window.searchTimeout);
                window.searchTimeout = setTimeout(() => {
                    if (keyword.length > 0) {
                        showLoading();
                        setTimeout(() => {
                            hideLoading();
                        }, 600);
                    }
                }, 500);
            });
            
            // 开始测试按钮点击
            document.addEventListener("click", (e) => {
                if (e.target.classList.contains("start-test") || e.target.parentElement.classList.contains("start-test")) {
                    const testItem = e.target.closest(".test-item");
                    const testTitle = testItem.querySelector(".test-title").textContent;
                    alert(`进入测试：${testTitle}`);
                }
            });
        }
        
        // 加载更多测试
        function loadMoreTests() {
            showLoading();
            
            // 模拟加载延迟
            setTimeout(() => {
                // 移除加载更多按钮
                testsList.removeChild(loadMoreBtn);
                
                // 添加新测试项
                moreTests.forEach(test => {
                    const testElement = createTestElement(test);
                    testsList.appendChild(testElement);
                });
                
                // 重新添加加载更多按钮
                testsList.appendChild(loadMoreBtn);
                hideLoading();
            }, 1000);
        }
        
        // 创建测试项元素
        function createTestElement(test) {
            const testElement = document.createElement("div");
            testElement.className = `test-item ${test.type}`;
            
            // 构建图片HTML
            let imageHtml = "";
            
            if (test.type === "single-image") {
                imageHtml = `
                    <div class="test-image">
                        <img src="${test.image}" alt="${test.title}">
                    </div>
                `;
            } else if (test.type === "multi-image") {
                imageHtml = `<div class="multi-images-container">`;
                test.images.forEach(img => {
                    imageHtml += `
                        <div class="multi-image-item">
                            <img src="${img}" alt="测试相关图片">
                        </div>
                    `;
                });
                imageHtml += `</div>`;
            }
            
            // 构建统计数据HTML
            let statsHtml = "";
            if (test.stats) {
                statsHtml = `<div class="results-stats">`;
                
                if (test.stats.questions) {
                    statsHtml += `
                        <div class="stat-item">
                            <div class="stat-value">${test.stats.questions}题</div>
                            <div class="stat-label">题目数量</div>
                        </div>
                    `;
                }
                
                if (test.stats.time) {
                    statsHtml += `
                        <div class="stat-item">
                            <div class="stat-value">${test.stats.time}</div>
                            <div class="stat-label">完成时间</div>
                        </div>
                    `;
                }
                
                if (test.stats.accuracy) {
                    statsHtml += `
                        <div class="stat-item">
                            <div class="stat-value">${test.stats.accuracy}</div>
                            <div class="stat-label">准确率</div>
                        </div>
                    `;
                }
                
                statsHtml += `</div>`;
            }
            
            // 组装测试项HTML
            testElement.innerHTML = `
                ${imageHtml}
                <div class="test-content">
                    <span class="test-category">${test.category}</span>
                    <h3 class="test-title">${test.title}</h3>
                    <p class="test-desc">${test.desc}</p>
                    
                    ${statsHtml}
                    
                    <div class="test-meta">
                        <div class="meta-left">
                            <div class="meta-item">
                                <i class="fas fa-user"></i>
                                <span>${test.meta.users} 人已测</span>
                            </div>
                            <div class="meta-item">
                                <i class="fas fa-star"></i>
                                <span>${test.meta.rating}</span>
                            </div>
                        </div>
                        <div class="start-test">开始测试</div>
                    </div>
                </div>
            `;
            
            return testElement;
        }
        
        // 显示加载状态
        function showLoading() {
            loadMoreBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 加载中...';
            loadMoreBtn.style.pointerEvents = "none";
        }
        
        // 隐藏加载状态
        function hideLoading() {
            loadMoreBtn.innerHTML = "加载更多测试";
            loadMoreBtn.style.pointerEvents = "auto";
        }
        
        // 初始化页面
        document.addEventListener("DOMContentLoaded", init);
    </script>
</body>
</html>
